package com.sc.web.gwt.client.presenter;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.sc.web.gwt.client.ClientFactory;
import com.sc.web.gwt.client.place.RegisterWidgetPlace;
import com.sc.web.gwt.client.view.RegisterWidget.RegisterWidgetView;


/**
 * Created by IntelliJ IDEA.
 * User: admin
 * Date: 6/8/11
 * Time: 10:18 AM
 * To change this template use File | Settings | File Templates.
 */
public class RegisterActivity extends AbstractActivity implements RegisterWidgetView.Presenter {
    // Used to obtain views, eventBus, placeController
    // Alternatively, could be injected via GIN
    private ClientFactory clientFactory;
    private RegisterWidgetView registerWidgetView;

    public RegisterActivity(RegisterWidgetPlace place, ClientFactory clientFactory) {
        this.clientFactory = clientFactory;
    }

    public void start(AcceptsOneWidget panel, EventBus eventBus) {
        registerWidgetView = clientFactory.getRegisterWidgetView();
        registerWidgetView.setPresenter(this);
        panel.setWidget(registerWidgetView.asWidget());
    }

    public void goTo(Place place) {
        clientFactory.getPlaceController().goTo(place);
    }

    public void clearFields() {
        registerWidgetView.clearFields();
    }
}
